const path = require("path")
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports={
  mode: "development",
  devtool: 'source-map',
  entry: "./src/index.ts",
  output:{
    path: path.resolve(__dirname, 'dist'),
    filename: 'main.[contenthash:8].js'
  },
  resolve:{
    extensions:[".js",".ts"],
    alias:{
      "@":path.resolve(__dirname,"src")
    }
  },
  module:{
    rules:[{
      test: /\.ts$/,
      exclude: /node_modules/,
      use:{
        loader:'babel-loader',
        options:{
          presets:['@babel/preset-env','@babel/preset-typescript']
        }
      }
      
    }]
  },
  plugins:[
    new HtmlWebpackPlugin({
      template: './public/index.html'
    })
  ],
  devServer:{
    host:"localhost",
    port: 8000
  }
}